package com.flying.invest.summary.model;

import java.util.Date;

import com.flying.framework.data.Data;
import com.flying.common.util.Codes;
import com.flying.framework.annotation.Param;
import com.flying.framework.annotation.ServiceField;
import com.flying.framework.annotation.ServiceFieldParam;
import com.flying.framework.data.DataSerializable;
import com.flying.framework.metadata.Meta;
import com.flying.invest.account.model.Account;
import com.flying.invest.invest.model.Investment.Status;

@SuppressWarnings("serial")
@Meta(id="i_summary_invest_daily",title="", table="i_summary_invest_daily", primaryKeys={"summary_id"})
public class SummaryInvestDaily extends Data implements DataSerializable {
	public final static String ENTITY_NAME = "i_summary_invest_daily";
	
	public final static String SUMMARY_ID = "summary_id";
	public final static String USER_ID = "user_id";
	public final static String ASSETS_ID = "assets_id";
	public final static String INVEST_ID = "invest_id";
	public final static String ACCOUNT_ID = "account_id";
	public final static String STATUS = "status";
	public final static String NAME = "name";
	public final static String SUM_DATE = "sum_date";
	public final static String SUMMARY_DATE = "summary_date";
	public final static String CURRENCY = "currency";
	public final static String CURRENCY_RATE = "currency_rate";
	public final static String ACTUAL_MONEY = "actual_money";
	public final static String QUANTITY = "quantity";
	public final static String TAX = "tax";
	public final static String COST = "cost";
	public final static String COST_PRICE = "cost_price";
	public final static String AMOUNT = "amount";
	public final static String PRICE = "price";
	public final static String PROFIT = "profit";
	public final static String PERIOD_PROFIT = "period_profit";
	public final static String LIMIT_RATE = "limit_rate";
	public final static String ACTUALLY_RATE = "actually_rate";
	public final static String PERIOD_BUY_AMOUNT = "period_buy_amount";
	public final static String PERIOD_BUY_COUNT = "period_buy_count";
	public final static String PERIOD_SELL_AMOUNT = "period_sell_amount";
	public final static String PERIOD_SELL_COUNT = "period_sell_count";
	public final static String CREATE_TIME = "create_time";
	
	
	@Param(value=SUMMARY_ID,   required=true,   desc="ID" , generator=Codes.AUTO_INCREMENT)
	private Long summaryId;
	
	@Param(value=USER_ID,   required=true,   desc="用户ID" )
	private Long userId;
	
	@Param(value=ASSETS_ID,   required=true,   desc="投资品种" )
	private Long assetsId;
	
	@Param(value=INVEST_ID,   required=true,   desc="投资ID" )
	private Long investId;
	
	@Param(value=ACCOUNT_ID,   required=true,   desc="账户ID" )
	private Long accountId;
	
	@Param(value=STATUS,   required=false,   maxlength=0, enumClass=Status.class,	desc="状态" )
	private Integer status;
	
	@Param(value=NAME,   required=true,   maxlength=50,	desc="名称" )
	private String name;
	
	@Param(value=SUM_DATE,   required=true,   maxlength=10,	desc="汇总日期" )
	private String sumDate;
	
	@Param(value=SUMMARY_DATE,   required=true,   desc="汇总日期" )
	private Date summaryDate;
	
	@Param(value=CURRENCY,   required=true,   maxlength=10,	desc="币种" )
	private String currency;
	
	@Param(value=CURRENCY_RATE,   required=true,   desc="汇率" )
	private Double currencyRate;
	
	@Param(value=ACTUAL_MONEY,   required=false,   desc="实际投入金额" )
	private Double actualMoney;
	
	@Param(value=QUANTITY,   required=false,   desc="资产数量" )
	private Double quantity;
	
	@Param(value=TAX,   required=false,   desc="税额" )
	private Double tax;
	
	@Param(value=COST,   required=false,   desc="成本" )
	private Double cost;
	
	@Param(value=COST_PRICE,   required=false,   desc="成本价" )
	private Double costPrice;
	
	@Param(value=AMOUNT,   required=false,   desc="市值" )
	private Double amount;
	
	@Param(value=LIMIT_RATE,   required=false,   desc="限制比例" )
	private Double limitRate;
	
	@Param(value=ACTUALLY_RATE,   required=false,   desc="实际比例" )
	private Double actuallyRate;
	
	@Param(value=PRICE,   required=false,   desc="价格" )
	private Double price;
	
	@Param(value=PROFIT,   required=false,   desc="利润" )
	private Double profit;
	
	@Param(value=PERIOD_PROFIT,   required=false,   desc="当期利润" )
	private Double periodProfit;
	
	@Param(value=PERIOD_BUY_AMOUNT,   required=false,   desc="买入金额" )
	private Double periodBuyAmount;
	
	@Param(value=PERIOD_BUY_COUNT,   required=false,   desc="买入笔数" )
	private Integer periodBuyCount;
	
	@Param(value=PERIOD_SELL_AMOUNT,   required=false,   desc="卖出金额" )
	private Double periodSellAmount;
	
	@Param(value=PERIOD_SELL_COUNT,   required=false,   desc="卖出笔数" )
	private Integer periodSellCount;
	
	@Param(value=CREATE_TIME,   required=false,   desc="创建时间" )
	private Date createTime;

	@ServiceField(serviceId="AccountService:findById", params={@ServiceFieldParam(param=Account.ACCOUNT_ID, value="$"+ACCOUNT_ID)})
	@Param(value="account",   required=false,	desc="账户", ignored=true)
	private Account account;
	
	
	public Long getSummaryId() {
		return this.summaryId;
	}
	
	public void setSummaryId(Long summaryId) {
		this.summaryId = summaryId;
	}
	
	public Long getUserId() {
		return this.userId;
	}
	
	public void setUserId(Long userId) {
		this.userId = userId;
	}
	
	public Long getAssetsId() {
		return assetsId;
	}

	public void setAssetsId(Long assetsId) {
		this.assetsId = assetsId;
	}

	public Long getAccountId() {
		return accountId;
	}

	public void setAccountId(Long accountId) {
		this.accountId = accountId;
	}

	public Long getInvestId() {
		return this.investId;
	}
	
	public void setInvestId(Long investId) {
		this.investId = investId;
	}
	
	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSumDate() {
		return this.sumDate;
	}
	
	public void setSumDate(String sumDate) {
		this.sumDate = sumDate;
	}
	
	public Date getSummaryDate() {
		return this.summaryDate;
	}
	
	public void setSummaryDate(Date summaryDate) {
		this.summaryDate = summaryDate;
	}
	
	public String getCurrency() {
		return this.currency;
	}
	
	public void setCurrency(String currency) {
		this.currency = currency;
	}
	
	public Double getCurrencyRate() {
		return this.currencyRate;
	}
	
	public void setCurrencyRate(Double currencyRate) {
		this.currencyRate = currencyRate;
	}
	
	public Double getActualMoney() {
		return this.actualMoney;
	}
	
	public void setActualMoney(Double actualMoney) {
		this.actualMoney = actualMoney;
	}
	
	public Double getQuantity() {
		return this.quantity;
	}
	
	public void setQuantity(Double quantity) {
		this.quantity = quantity;
	}
	
	public Double getTax() {
		return this.tax;
	}
	
	public void setTax(Double tax) {
		this.tax = tax;
	}
	
	public Double getCost() {
		return this.cost;
	}
	
	public void setCost(Double cost) {
		this.cost = cost;
	}
	
	public Double getCostPrice() {
		return this.costPrice;
	}
	
	public void setCostPrice(Double costPrice) {
		this.costPrice = costPrice;
	}
	
	public Double getAmount() {
		return this.amount;
	}
	
	public void setAmount(Double amount) {
		this.amount = amount;
	}
	
	public Double getLimitRate() {
		return limitRate;
	}

	public void setLimitRate(Double limitRate) {
		this.limitRate = limitRate;
	}

	public Double getActuallyRate() {
		return actuallyRate;
	}

	public void setActuallyRate(Double actuallyRate) {
		this.actuallyRate = actuallyRate;
	}

	public Double getPrice() {
		return this.price;
	}
	
	public void setPrice(Double price) {
		this.price = price;
	}
	
	public Double getProfit() {
		return profit;
	}

	public void setProfit(Double profit) {
		this.profit = profit;
	}

	public Double getPeriodProfit() {
		return periodProfit;
	}

	public void setPeriodProfit(Double periodProfit) {
		this.periodProfit = periodProfit;
	}

	public Date getCreateTime() {
		return this.createTime;
	}
	
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Double getPeriodBuyAmount() {
		return periodBuyAmount;
	}

	public void setPeriodBuyAmount(Double periodBuyAmount) {
		this.periodBuyAmount = periodBuyAmount;
	}

	public Integer getPeriodBuyCount() {
		return periodBuyCount;
	}

	public void setPeriodBuyCount(Integer periodBuyCount) {
		this.periodBuyCount = periodBuyCount;
	}

	public Double getPeriodSellAmount() {
		return periodSellAmount;
	}

	public void setPeriodSellAmount(Double periodSellAmount) {
		this.periodSellAmount = periodSellAmount;
	}

	public Integer getPeriodSellCount() {
		return periodSellCount;
	}

	public void setPeriodSellCount(Integer periodSellCount) {
		this.periodSellCount = periodSellCount;
	}

	public Account getAccount() {
		return account;
	}
	
	public String getAccountName() {
		Account t = this.getAccount();
		return t == null? null: t.getName();
	}
}